<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
var req = new CurlHttpRequest();
params = JSON.parse(value);
// proxy = params.HTTPProxy;
// req.SetProxy(proxy);
req.AddHeader('Content-Type: application/json;charset=utf-8');

Zabbix.Log(127, 'webhook request value='+value);
var hostName = params.HOSTNAME;

var hostNameUrlMap = {
    'renyuandingwei':"renyuandingweiUrl"
};

var urlMap = {
'publicUrl':'https://oapi.dingtalk.com/robot/send?access_token=96aaeff9a6d51e3cfb01cd5f7c02611d0c6b606a23ddc24ec1bf1db7eba3f087',
'renyuandingweiUrl':'https://oapi.dingtalk.com/robot/send?access_token=447eb033c2ebbce893d880fe388ed43cc9674eef906d9efd0c2269c73d64609b',
'dicmsUrl':'http://172.25.25.17:8080/dicms/api/desktop/robot/send'
};
//var url = urlMap.publicUrl;
var url = '';
if(hostNameUrlMap[hostName]&&urlMap[hostNameUrlMap[hostName]]){
    url = urlMap[hostNameUrlMap[hostName]];
}else{
    url = urlMap.publicUrl;
}
resp = req.Post(url,
    // JSON.stringify({"msgtype":"text","text":{"content":value},"at":{ "atMobiles": ["xxxxxxxxxxxxx"],"isAtAll": false}})
    JSON.stringify({"msgtype": "markdown","markdown": {"title": "信息中心检测系统","text": params.MESSAGE},"at": {"atMobiles": ["XXXXXXXXXXX"],"isAtAll": false}})
);

Zabbix.Log(127, 'response code: '+req.Status());
return JSON.stringify(resp);
    </script>
</body>
</html>